Set up working space
rm(list=ls())
library(plyr)
library(nlme)
library(ggplot2)
Define calibration functions
lm_e<-function(df){
m = lm(value_norm_ribitol ~ uM, df);
yint <- format(coef(m)[1], digits = 3);
slope <- format(coef(m)[2], digits = 3);
r2 <- format(summary(m)$r.squared, digits = 3);
dd<-data.frame(slope=slope, yint=yint, r2= r2);
return(dd);
}
Generate calibration curves from 2016 for IN-EDGE-OUT plots
df<-read.csv('Data/targeted_porewater/calibration_data_2016.csv')
df.kiel<-read.csv('Data/targeted_porewater/kiel_calibration.csv')
df$value_norm_ribitol<-df$value/df$Ribitol..int.standard..Results
df.kiel$value_norm_ribitol<-df.kiel$value/df.kiel$Ribitol..int.standard..Results
Calculate calibration curves
eqns2<-ddply(df.kiel, .(Compound),lm_e)
eqns2
## Compound
## 1 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 2 D-Glucose, 2,3,4,5,6-pentakis-O-(trimethylsilyl),o-methyloxyme, (1Z) Results
## 3 D-Mannitol, 1,2,3,4,5,6-hexakis-O-(trimethylsilyl) Results
## 4 D-Trehalose, octakis(trimethylsilyl) ether Results
## 5 Myo-inositol, 1,2,3,4,5,6-hexakis-O-(trimethylsilyl) Results
## 6 Sucrose, octakis(trimethylsily) ether Results
## slope yint r2
## 1 0.00854 -0.00268 0.983
## 2 0.00694 -0.00185 0.956
## 3 0.0125 -0.00331 0.91
## 4 0.155 -0.0521 0.961
## 5 0.0142 -0.00304 0.937
## 6 0.149 -0.0326 0.898
eqns<-ddply(df, .(Compound),lm_e)
eqns
## Compound
## 1 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 2 D-Glucose, 2,3,4,5,6-pentakis-O-(trimethylsilyl),o-methyloxyme, (1Z) Results
## 3 D-Mannitol, 1,2,3,4,5,6-hexakis-O-(trimethylsilyl) Results
## 4 D-Trehalose, octakis(trimethylsilyl) ether Results
## 5 Myo-inositol, 1,2,3,4,5,6-hexakis-O-(trimethylsilyl) Results
## 6 Sucrose, octakis(trimethylsily) ether Results
## slope yint r2
## 1 0.00791 -0.00898 0.966
## 2 0.00932 -0.0549 0.826
## 3 0.0217 -0.134 0.953
## 4 0.0455 0.967 0.768
## 5 0.00949 -0.0612 0.849
## 6 0.0412 0.691 0.819
quant.df<-read.csv('Data/targeted_porewater/in_edge_out_sugar_compounds.csv')
quant.df$value_ribitol<-quant.df$value/quant.df$Ribitol_int.standard_Results
quant.df$FileID<-gsub('.D','',quant.df$Data.File)
head(quant.df)
## Name Data.File Ribitol_int.standard_Results
## 1 305 20161124_028.D 9466969
## 2 292 20161125_063.D 4579200
## 3 177 20161125_042.D 992497
## 4 161 20161117_047.D 8629549
## 5 oct 264 20170131_048.D 856726
## 6 oct d 255 20170125_016.D 395658
## Compound
## 1 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 2 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 3 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 4 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 5 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 6 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## value value_ribitol FileID
## 1 0 0 20161124_028
## 2 0 0 20161125_063
## 3 0 0 20161125_042
## 4 0 0 20161117_047
## 5 0 0 20170131_048
## 6 0 0 20170125_016
Add in calibration data and convert to uM conc<-normalized value / slope
quant.df$slope<-as.numeric(as.vector(eqns[match(quant.df$Compound,eqns$Compound),'slope']))
quant.df$Concentration_uM<-quant.df$value_ribitol/quant.df$slope
range(quant.df$Concentration_uM)
## [1] 0.000 1145.134
summary(quant.df$Concentration_uM)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.0000 0.0000 0.0310 5.5230 0.1655 1145.1337
Add in metadata
mdata<-read.csv('Data/targeted_porewater/mdata_salty_samples.csv')
head(mdata)
## X Sample_ID Collection_date Time Month Site
## 1 use 2085 4/10/17 9:00:00 AM April Carrie Bow Caye
## 2 use 2087 4/10/17 9:00:00 AM April Carrie Bow Caye
## 3 use 2086 4/10/17 9:00:00 AM April Carrie Bow Caye
## 4 use 2080 4/10/17 9:00:00 AM April Carrie Bow Caye
## 5 use 2079 4/10/17 9:00:00 AM April Carrie Bow Caye
## 6 use 989 4/6/17 10:00:00 AM April Twin Cayes
## Substrate ProfileID Sediment_depth_cm
## 1 coraline sediment Profile 3 0
## 2 coraline sediment Profile 4 0
## 3 coraline sediment Profile 3 -5
## 4 coraline sediment Profile 1 -10
## 5 coraline sediment Profile 1 -5
## 6 Fisheries beach Tutle seagrass Profile 6 -30
## GCMS_ID TransectLocation uL.of.mix MixID Analysis TransectID
## 1 MS16_20170713_039 <NA> NA <NA> CompSpp <NA>
## 2 MS16_20170713_045 <NA> NA <NA> CompSpp <NA>
## 3 MS16_20170713_051 <NA> NA <NA> CompSpp <NA>
## 4 MS16_20170726_037 <NA> NA <NA> CompSpp <NA>
## 5 MS16_20170726_042 <NA> NA <NA> CompSpp <NA>
## 6 MS16_20170712_008 <NA> NA <NA> CompSpp <NA>
## Keep
## 1 <NA>
## 2 <NA>
## 3 <NA>
## 4 <NA>
## 5 <NA>
## 6 <NA>
quant.df$location<-droplevels(mdata[match(quant.df$FileID, mdata$GCMS_ID),'TransectLocation'])
quant.df$depth_cm<-mdata[match(quant.df$FileID, mdata$GCMS_ID),'Sediment_depth_cm']
quant.df$month<-droplevels(mdata[match(quant.df$FileID, mdata$GCMS_ID),'Month'])
head(quant.df)
## Name Data.File Ribitol_int.standard_Results
## 1 305 20161124_028.D 9466969
## 2 292 20161125_063.D 4579200
## 3 177 20161125_042.D 992497
## 4 161 20161117_047.D 8629549
## 5 oct 264 20170131_048.D 856726
## 6 oct d 255 20170125_016.D 395658
## Compound
## 1 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 2 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 3 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 4 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 5 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 6 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## value value_ribitol FileID slope Concentration_uM location
## 1 0 0 20161124_028 0.00791 0 In
## 2 0 0 20161125_063 0.00791 0 Edge
## 3 0 0 20161125_042 0.00791 0 In
## 4 0 0 20161117_047 0.00791 0 In
## 5 0 0 20170131_048 0.00791 0 Edge
## 6 0 0 20170125_016 0.00791 0 Edge
## depth_cm month
## 1 0 October
## 2 -30 October
## 3 -30 October
## 4 -30 October
## 5 -30 October
## 6 -15 October
Sugar concentration by location - targeted analysis
sugars<-quant.df
head(sugars)
## Name Data.File Ribitol_int.standard_Results
## 1 305 20161124_028.D 9466969
## 2 292 20161125_063.D 4579200
## 3 177 20161125_042.D 992497
## 4 161 20161117_047.D 8629549
## 5 oct 264 20170131_048.D 856726
## 6 oct d 255 20170125_016.D 395658
## Compound
## 1 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 2 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 3 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 4 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 5 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 6 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## value value_ribitol FileID slope Concentration_uM location
## 1 0 0 20161124_028 0.00791 0 In
## 2 0 0 20161125_063 0.00791 0 Edge
## 3 0 0 20161125_042 0.00791 0 In
## 4 0 0 20161117_047 0.00791 0 In
## 5 0 0 20170131_048 0.00791 0 Edge
## 6 0 0 20170125_016 0.00791 0 Edge
## depth_cm month
## 1 0 October
## 2 -30 October
## 3 -30 October
## 4 -30 October
## 5 -30 October
## 6 -15 October
forMod<-sugars[grep('Sucrose',sugars$Compound),]
range(forMod$Concentration_uM)
## [1] 0.000 1145.134
mod<-aov(data=forMod, formula = log(Concentration_uM+0.001) ~ location*factor(depth_cm))
# Check assumptions
par(mfrow=c(2,2));qqnorm(resid(mod));hist(resid(mod));plot(fitted(mod), residuals(mod))
par(mfrow=c(2,2));plot(mod)
#Model summary
summary(mod)
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 573.6 286.82 30.798 7.7e-11 ***
## factor(depth_cm) 6 279.3 46.55 4.998 0.000192 ***
## location:factor(depth_cm) 12 118.9 9.91 1.064 0.400387
## Residuals 87 810.2 9.31
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
mod
## Call:
## aov(formula = log(Concentration_uM + 0.001) ~ location * factor(depth_cm),
## data = forMod)
##
## Terms:
## location factor(depth_cm) location:factor(depth_cm)
## Sum of Squares 573.6493 279.2838 118.8760
## Deg. of Freedom 2 6 12
## Residuals
## Sum of Squares 810.2292
## Deg. of Freedom 87
##
## Residual standard error: 3.051718
## Estimated effects may be unbalanced
TukeyHSD(mod, which = 'location')
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = log(Concentration_uM + 0.001) ~ location * factor(depth_cm), data = forMod)
##
## $location
## diff lwr upr p adj
## In-Edge 4.8526750 3.148375 6.556975 0.0000000
## Out-Edge 0.4811812 -1.653783 2.616145 0.8531291
## Out-In -4.3714937 -6.212564 -2.530424 0.0000006
TukeyHSD(mod, which = 'factor(depth_cm)')
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = log(Concentration_uM + 0.001) ~ location * factor(depth_cm), data = forMod)
##
## $`factor(depth_cm)`
## diff lwr upr p adj
## -25--30 1.9084726 -1.3482430 5.16518812 0.5723722
## -20--30 3.6012365 0.3445210 6.85795208 0.0204535
## -15--30 4.2331288 0.9225796 7.54367797 0.0039545
## -10--30 3.9683592 0.7116437 7.22507476 0.0071724
## -5--30 2.9583782 -0.3521710 6.26892739 0.1112443
## 0--30 0.2440305 -3.1269904 3.61505136 0.9999904
## -20--25 1.6927640 -1.5639516 4.94947951 0.7021980
## -15--25 2.3246562 -0.9858930 5.63520540 0.3507078
## -10--25 2.0598866 -1.1968289 5.31660219 0.4799493
## -5--25 1.0499056 -2.2606436 4.36045482 0.9616329
## 0--25 -1.6644421 -5.0354629 1.70657880 0.7497615
## -15--20 0.6318922 -2.6786570 3.94244145 0.9973331
## -10--20 0.3671227 -2.8895929 3.62383823 0.9998691
## -5--20 -0.6428583 -3.9534076 2.66769087 0.9970659
## 0--20 -3.3572060 -6.7282269 0.01381484 0.0516634
## -10--15 -0.2647696 -3.5753188 3.04577965 0.9999826
## -5--15 -1.2747506 -4.6382719 2.08877078 0.9124786
## 0--15 -3.9890983 -7.4121556 -0.56604092 0.0118917
## -5--10 -1.0099810 -4.3205302 2.30056818 0.9682450
## 0--10 -3.7243287 -7.0953496 -0.35330784 0.0206322
## 0--5 -2.7143477 -6.1374050 0.70870966 0.2139019
forMod<-sugars[grep('Trehalose',sugars$Compound),]
range(forMod$Concentration_uM)
## [1] 0.00000 41.84326
mod<-aov(data=forMod, formula = log(Concentration_uM+0.001) ~ location*factor(depth_cm))
# Check assumptions
par(mfrow=c(2,2));qqnorm(resid(mod));hist(resid(mod));plot(fitted(mod), residuals(mod))
par(mfrow=c(2,2));plot(mod)
#Model summary
summary(mod)
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 71.8 35.92 3.707 0.0285 *
## factor(depth_cm) 6 90.8 15.14 1.562 0.1679
## location:factor(depth_cm) 12 58.2 4.85 0.500 0.9091
## Residuals 87 843.1 9.69
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(mod, which = 'location')
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = log(Concentration_uM + 0.001) ~ location * factor(depth_cm), data = forMod)
##
## $location
## diff lwr upr p adj
## In-Edge 1.5679888 -0.1705099 3.3064876 0.0857272
## Out-Edge -0.1643401 -2.3421449 2.0134648 0.9823128
## Out-In -1.7323289 -3.6103424 0.1456846 0.0768901
forMod<-sugars[grep('Myo-inositol',sugars$Compound),]
range(forMod$Concentration_uM)
## [1] 0.000000 1.944473
mod<-aov(data=forMod, formula = log(Concentration_uM+0.001) ~ location*factor(depth_cm))
# Check assumptions
par(mfrow=c(2,2));qqnorm(resid(mod));hist(resid(mod));plot(fitted(mod), residuals(mod))
par(mfrow=c(2,2));plot(mod)
#Model summary
summary(mod)
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 70.69 35.34 11.825 2.87e-05 ***
## factor(depth_cm) 6 49.76 8.29 2.775 0.0162 *
## location:factor(depth_cm) 12 35.89 2.99 1.001 0.4554
## Residuals 87 260.03 2.99
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(mod, which = 'location')
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = log(Concentration_uM + 0.001) ~ location * factor(depth_cm), data = forMod)
##
## $location
## diff lwr upr p adj
## In-Edge 1.969114 1.0036069 2.9346212 0.0000151
## Out-Edge 1.389117 0.1796332 2.5986009 0.0202574
## Out-In -0.579997 -1.6229863 0.4629922 0.3847041
TukeyHSD(mod, which = 'factor(depth_cm)')
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = log(Concentration_uM + 0.001) ~ location * factor(depth_cm), data = forMod)
##
## $`factor(depth_cm)`
## diff lwr upr p adj
## -25--30 1.07010782 -0.77486235 2.9150780 0.5843785
## -20--30 1.08014581 -0.76482436 2.9251160 0.5734878
## -15--30 2.05529421 0.17982660 3.9307618 0.0223248
## -10--30 1.79734189 -0.04762828 3.6423121 0.0612945
## -5--30 1.28184012 -0.59362749 3.1573077 0.3837493
## 0--30 0.32937323 -1.58035233 2.2390988 0.9984880
## -20--25 0.01003799 -1.83493218 1.8550082 1.0000000
## -15--25 0.98518639 -0.89028122 2.8606540 0.6917600
## -10--25 0.72723407 -1.11773610 2.5722042 0.8962122
## -5--25 0.21173230 -1.66373531 2.0871999 0.9998679
## 0--25 -0.74073459 -2.65046015 1.1689910 0.9031667
## -15--20 0.97514840 -0.90031921 2.8506160 0.7018727
## -10--20 0.71719608 -1.12777409 2.5621663 0.9022389
## -5--20 0.20169431 -1.67377330 2.0771619 0.9999006
## 0--20 -0.75077258 -2.66049814 1.1589530 0.8973812
## -10--15 -0.25795232 -2.13341993 1.6175153 0.9995844
## -5--15 -0.77345409 -2.67893109 1.1320229 0.8824641
## 0--15 -1.72592098 -3.66512585 0.2132839 0.1140861
## -5--10 -0.51550177 -2.39096938 1.3599658 0.9811817
## 0--10 -1.46796866 -3.37769422 0.4417569 0.2464019
## 0--5 -0.95246689 -2.89167176 0.9867380 0.7543238
forMod<-sugars[grep('Fructose',sugars$Compound),]
range(forMod$Concentration_uM)
## [1] 0.00000 10.59883
mod<-aov(data=forMod, formula = log(Concentration_uM+0.001) ~ location*factor(depth_cm))
# Check assumptions
par(mfrow=c(2,2));qqnorm(resid(mod));hist(resid(mod));plot(fitted(mod), residuals(mod))
par(mfrow=c(2,2));plot(mod)
#Model summary
summary(mod)
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 13.1 6.549 1.191 0.3087
## factor(depth_cm) 6 93.2 15.541 2.827 0.0146 *
## location:factor(depth_cm) 12 52.5 4.375 0.796 0.6535
## Residuals 87 478.3 5.497
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(mod, which = 'factor(depth_cm)')
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = log(Concentration_uM + 0.001) ~ location * factor(depth_cm), data = forMod)
##
## $`factor(depth_cm)`
## diff lwr upr p adj
## -25--30 0.3267038 -2.1754667 2.82887422 0.9996923
## -20--30 0.6438472 -1.8583233 3.14601762 0.9866143
## -15--30 1.5262235 -1.0173079 4.06975498 0.5442882
## -10--30 1.6815935 -0.8205769 4.18376401 0.4045882
## -5--30 2.7526961 0.2091646 5.29622755 0.0251556
## 0--30 0.1502695 -2.4397230 2.74026203 0.9999974
## -20--25 0.3171434 -2.1850271 2.81931387 0.9997409
## -15--25 1.1995198 -1.3440117 3.74305123 0.7877184
## -10--25 1.3548898 -1.1472807 3.85706026 0.6606398
## -5--25 2.4259923 -0.1175391 4.96952379 0.0716900
## 0--25 -0.1764342 -2.7664267 2.41355828 0.9999933
## -15--20 0.8823764 -1.6611551 3.42590783 0.9413087
## -10--20 1.0377464 -1.4644241 3.53991686 0.8714618
## -5--20 2.1088489 -0.4346825 4.65238039 0.1712304
## 0--20 -0.4935776 -3.0835701 2.09641488 0.9973564
## -10--15 0.1553700 -2.3881614 2.69890149 0.9999965
## -5--15 1.2264726 -1.3577580 3.81070311 0.7827292
## 0--15 -1.3759540 -4.0059267 1.25401871 0.6957771
## -5--10 1.0711025 -1.4724289 3.61463400 0.8631727
## 0--10 -1.5313240 -4.1213165 1.05866849 0.5618886
## 0--5 -2.6024265 -5.2323992 0.02754615 0.0543460
forMod<-sugars[grep('Mannitol',sugars$Compound),]
range(forMod$Concentration_uM)
## [1] 0.000000 3.101659
mod<-aov(data=forMod, formula = log(Concentration_uM+0.001) ~ location*factor(depth_cm))
# Check assumptions
par(mfrow=c(2,2));qqnorm(resid(mod));hist(resid(mod));plot(fitted(mod), residuals(mod))
par(mfrow=c(2,2));plot(mod)
#Model summary
summary(mod)
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 177.9 88.97 17.179 5.15e-07 ***
## factor(depth_cm) 6 85.5 14.26 2.753 0.0169 *
## location:factor(depth_cm) 12 87.8 7.31 1.412 0.1759
## Residuals 87 450.6 5.18
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(mod, which = 'location')
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = log(Concentration_uM + 0.001) ~ location * factor(depth_cm), data = forMod)
##
## $location
## diff lwr upr p adj
## In-Edge 2.9137593 1.6427815 4.1847371 0.0000013
## Out-Edge 0.8724829 -0.7196619 2.4646276 0.3953265
## Out-In -2.0412765 -3.4142504 -0.6683025 0.0018190
TukeyHSD(mod, which = 'factor(depth_cm)')
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = log(Concentration_uM + 0.001) ~ location * factor(depth_cm), data = forMod)
##
## $`factor(depth_cm)`
## diff lwr upr p adj
## -25--30 0.99024446 -1.43844406 3.4189330 0.8802458
## -20--30 1.49429301 -0.93439551 3.9229815 0.5139385
## -15--30 2.18503487 -0.28379998 4.6538697 0.1180943
## -10--30 2.52766919 0.09898067 4.9563577 0.0358252
## -5--30 2.47986170 0.01102685 4.9486966 0.0482399
## 0--30 0.79618391 -1.71774754 3.3101154 0.9618845
## -20--25 0.50404855 -1.92463997 2.9327371 0.9957669
## -15--25 1.19479041 -1.27404444 3.6636253 0.7668727
## -10--25 1.53742473 -0.89126379 3.9661133 0.4789275
## -5--25 1.48961724 -0.97921761 3.9584521 0.5376388
## 0--25 -0.19406055 -2.70799200 2.3198709 0.9999859
## -15--20 0.69074185 -1.77809300 3.1595767 0.9794020
## -10--20 1.03337618 -1.39531234 3.4620647 0.8573066
## -5--20 0.98556869 -1.48326616 3.4544035 0.8904427
## 0--20 -0.69810910 -3.21204056 1.8158223 0.9801721
## -10--15 0.34263433 -2.12620052 2.8114692 0.9995622
## -5--15 0.29482684 -2.21351188 2.8031656 0.9998329
## 0--15 -1.38885096 -3.94158850 1.1638866 0.6556183
## -5--10 -0.04780749 -2.51664234 2.4210274 1.0000000
## 0--10 -1.73148529 -4.24541674 0.7824462 0.3742880
## 0--5 -1.68367780 -4.23641533 0.8690597 0.4279067
forMod<-sugars[grep('Glucose',sugars$Compound),]
range(forMod$Concentration_uM)
## [1] 0.00000 11.95779
mod<-aov(data=forMod, formula = log(Concentration_uM+0.001) ~ location*factor(depth_cm))
# Check assumptions
par(mfrow=c(2,2));qqnorm(resid(mod));hist(resid(mod));plot(fitted(mod), residuals(mod))
par(mfrow=c(2,2));plot(mod)
#Model summary
summary(mod)
## Df Sum Sq Mean Sq F value Pr(>F)
## location 2 49.3 24.664 5.662 0.00488 **
## factor(depth_cm) 6 68.8 11.474 2.634 0.02146 *
## location:factor(depth_cm) 12 57.5 4.791 1.100 0.37070
## Residuals 87 378.9 4.356
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(mod, which = 'location')
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = log(Concentration_uM + 0.001) ~ location * factor(depth_cm), data = forMod)
##
## $location
## diff lwr upr p adj
## In-Edge 1.6317064 0.4661664 2.797246 0.0035255
## Out-Edge 0.9278377 -0.5322258 2.387901 0.2887866
## Out-In -0.7038687 -1.9629434 0.555206 0.3808765
TukeyHSD(mod, which = 'factor(depth_cm)')
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = log(Concentration_uM + 0.001) ~ location * factor(depth_cm), data = forMod)
##
## $`factor(depth_cm)`
## diff lwr upr p adj
## -25--30 0.46157612 -1.7656332 2.6887854 0.9957997
## -20--30 1.68857602 -0.5386333 3.9157853 0.2614432
## -15--30 2.05249856 -0.2115266 4.3165237 0.1015055
## -10--30 1.62123770 -0.6059716 3.8484470 0.3077956
## -5--30 2.00363355 -0.2603916 4.2676587 0.1181432
## 0--30 0.36408910 -1.9412915 2.6694697 0.9990820
## -20--25 1.22699990 -1.0002094 3.4542092 0.6422004
## -15--25 1.59092244 -0.6731027 3.8549476 0.3498455
## -10--25 1.15966158 -1.0675477 3.3868709 0.7004998
## -5--25 1.54205742 -0.7219677 3.8060826 0.3880226
## 0--25 -0.09748702 -2.4028677 2.2078936 0.9999996
## -15--20 0.36392254 -1.9001026 2.6279477 0.9989851
## -10--20 -0.06733832 -2.2945476 2.1598710 0.9999999
## -5--20 0.31505752 -1.9489676 2.5790827 0.9995554
## 0--20 -1.32448692 -3.6298676 0.9808937 0.5953621
## -10--15 -0.43126086 -2.6952860 1.8327643 0.9973631
## -5--15 -0.04886501 -2.3491169 2.2513869 1.0000000
## 0--15 -1.68840946 -4.0293769 0.6525580 0.3186416
## -5--10 0.38239584 -1.8816293 2.6464210 0.9986564
## 0--10 -1.25714860 -3.5625292 1.0482320 0.6531828
## 0--5 -1.63954444 -3.9805119 0.7014230 0.3538668
df<-sugars
# New Facet Labels
df$NewFacets<-"NA"
df[df$location=='In','NewFacets']<-'Posidonia oceanica'
df[df$location=='Edge','NewFacets']<-'Edge of the meadow'
df[df$location=='Out','NewFacets']<-'Outside the meadow'
df$NewFacets<-factor(df$NewFacets, ordered=T, levels=c('Posidonia oceanica', 'Edge of the meadow', 'Outside the meadow'))
df$location<-factor(df$location, ordered=T, levels=c('In','Edge','Out'))
#For clarity, code vlaues that are 0 as NA for plottoing
df[df$Concentration_uM==0,'Concentration_uM']<-NA
df[which(df$Concentration_uM > 200),'Concentration_uM']<-201
fig1C<-ggplot(df, aes(x=Compound, y=depth_cm)) +
geom_jitter(pch=21,color='black',aes(size=Concentration_uM, fill=Compound), height=0.1, width=0.2, alpha=0.65) + scale_size_area(breaks=c(1,25,50,75,100,201), max_size = 10) +
facet_grid(~location) +
guides(fill=F, color=F,size=guide_legend(ncol=1))+ labs(size=expression(paste('Concentration (',mu,'M)')))+
ylab('Sediment depth (cm)') + xlab('') +
theme(legend.key = element_blank(), legend.background = element_blank(), legend.key.size=unit(0.25,'cm'))+
theme(axis.text.x = element_text(angle=45,hjust=1))
fig1C
## Warning: Removed 247 rows containing missing values (geom_point).
quant.df<-read.csv('Data/targeted_porewater/season_sugar_quant.csv')
quant.df$value_ribitol<-quant.df$value/quant.df$Ribitol..int.standard..Results
quant.df$FileID<-gsub('.D','',quant.df$Data.File)
head(quant.df)
## Name Data.File Ribitol..int.standard..Results
## 1 300 20161207_056.D 1259635
## 2 303 20161207_036.D 1055487
## 3 186 20161124_018.D 7771453
## 4 309 20161124_030.D 5153702
## 5 175 20161125_056.D 11985766
## 6 310 20161124_010.D 3070303
## Compound
## 1 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 2 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 3 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 4 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 5 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 6 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## value value_ribitol FileID
## 1 0 0 20161207_056
## 2 0 0 20161207_036
## 3 0 0 20161124_018
## 4 0 0 20161124_030
## 5 0 0 20161125_056
## 6 0 0 20161124_010
Add in calibration data and convert to uM conc<-normalized value / slope
quant.df$slope<-as.numeric(as.vector(eqns[match(quant.df$Compound,eqns$Compound),'slope']))
quant.df$Concentration_uM<-quant.df$value_ribitol/quant.df$slope
range(quant.df$Concentration_uM)
## [1] 0.000 1145.134
summary(quant.df$Concentration_uM)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.0000 0.0000 0.0071 6.5860 0.4487 1145.1337
Add in metadata
mdata<-read.csv('Data/targeted_porewater/mdata_salty_samples.csv')
head(mdata)
## X Sample_ID Collection_date Time Month Site
## 1 use 2085 4/10/17 9:00:00 AM April Carrie Bow Caye
## 2 use 2087 4/10/17 9:00:00 AM April Carrie Bow Caye
## 3 use 2086 4/10/17 9:00:00 AM April Carrie Bow Caye
## 4 use 2080 4/10/17 9:00:00 AM April Carrie Bow Caye
## 5 use 2079 4/10/17 9:00:00 AM April Carrie Bow Caye
## 6 use 989 4/6/17 10:00:00 AM April Twin Cayes
## Substrate ProfileID Sediment_depth_cm
## 1 coraline sediment Profile 3 0
## 2 coraline sediment Profile 4 0
## 3 coraline sediment Profile 3 -5
## 4 coraline sediment Profile 1 -10
## 5 coraline sediment Profile 1 -5
## 6 Fisheries beach Tutle seagrass Profile 6 -30
## GCMS_ID TransectLocation uL.of.mix MixID Analysis TransectID
## 1 MS16_20170713_039 <NA> NA <NA> CompSpp <NA>
## 2 MS16_20170713_045 <NA> NA <NA> CompSpp <NA>
## 3 MS16_20170713_051 <NA> NA <NA> CompSpp <NA>
## 4 MS16_20170726_037 <NA> NA <NA> CompSpp <NA>
## 5 MS16_20170726_042 <NA> NA <NA> CompSpp <NA>
## 6 MS16_20170712_008 <NA> NA <NA> CompSpp <NA>
## Keep
## 1 <NA>
## 2 <NA>
## 3 <NA>
## 4 <NA>
## 5 <NA>
## 6 <NA>
quant.df$location<-droplevels(mdata[match(quant.df$FileID, mdata$GCMS_ID),'TransectLocation'])
quant.df$depth_cm<-mdata[match(quant.df$FileID, mdata$GCMS_ID),'Sediment_depth_cm']
quant.df$month<-droplevels(mdata[match(quant.df$FileID, mdata$GCMS_ID),'Month'])
head(quant.df)
## Name Data.File Ribitol..int.standard..Results
## 1 300 20161207_056.D 1259635
## 2 303 20161207_036.D 1055487
## 3 186 20161124_018.D 7771453
## 4 309 20161124_030.D 5153702
## 5 175 20161125_056.D 11985766
## 6 310 20161124_010.D 3070303
## Compound
## 1 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 2 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 3 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 4 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 5 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 6 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## value value_ribitol FileID slope Concentration_uM location
## 1 0 0 20161207_056 0.00791 0 In
## 2 0 0 20161207_036 0.00791 0 In
## 3 0 0 20161124_018 0.00791 0 In
## 4 0 0 20161124_030 0.00791 0 In
## 5 0 0 20161125_056 0.00791 0 In
## 6 0 0 20161124_010 0.00791 0 In
## depth_cm month
## 1 -15 October
## 2 -20 October
## 3 -5 October
## 4 -20 October
## 5 -20 October
## 6 -25 October
unique(quant.df$month)
## [1] October July April
## Levels: April July October
df<-quant.df
forMod<-df[grep('Sucrose',df$Compound),]
forMod<-forMod[forMod$depth_cm %in% c(0,-10,-20,-30),] #compare the same depths
y<-forMod$Concentration_uM
month<-forMod$month
depth<-as.factor(forMod$depth_cm)
hist(log(y))
mod<-aov(log(y+0.001) ~ month) # transform to meet assumptions of model
summary(mod)
## Df Sum Sq Mean Sq F value Pr(>F)
## month 2 113.9 56.96 4.944 0.00998 **
## Residuals 66 760.4 11.52
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
par(mfrow=c(2,2))
plot(mod)
TukeyHSD(mod, which='month')
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = log(y + 0.001) ~ month)
##
## $month
## diff lwr upr p adj
## July-April -3.696815 -6.5315711 -0.8620586 0.0073167
## October-April -2.176829 -4.6221371 0.2684797 0.0906747
## October-July 1.519986 -0.8750134 3.9149856 0.2874293
#TukeyHSD(mod, which='depth')
forMod<-df[grep('Trehalose',df$Compound),]
forMod<-forMod[forMod$depth_cm %in% c(0,-10,-20,-30),] #compare the same depths
y<-forMod$Concentration_uM
month<-forMod$month
depth<-as.factor(forMod$depth_cm)
hist(log(y))
mod<-aov(log(y+0.001) ~ month) # transform to meet assumptions of model
summary(mod)
## Df Sum Sq Mean Sq F value Pr(>F)
## month 2 6.9 3.447 0.416 0.661
## Residuals 66 547.1 8.289
par(mfrow=c(2,2))
plot(mod)
#TukeyHSD(mod, which='depth')
forMod<-df[grep('Mannitol',df$Compound),]
forMod<-forMod[forMod$depth_cm %in% c(0,-10,-20,-30),] #compare the same depths
y<-forMod$Concentration_uM
month<-forMod$month
depth<-as.factor(forMod$depth_cm)
hist(log(y))
mod<-aov(log(y+0.001) ~ month) # transform to meet assumptions of model
summary(mod)
## Df Sum Sq Mean Sq F value Pr(>F)
## month 2 73.5 36.73 4.899 0.0104 *
## Residuals 66 494.9 7.50
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
par(mfrow=c(2,2))
plot(mod)
TukeyHSD(mod, which='month')
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = log(y + 0.001) ~ month)
##
## $month
## diff lwr upr p adj
## July-April -2.653750 -4.9406244 -0.3668746 0.0190148
## October-April -0.420805 -2.3935018 1.5518917 0.8660347
## October-July 2.232944 0.3008333 4.1650557 0.0195943
forMod<-df[grep('Glucose',df$Compound),]
forMod<-forMod[forMod$depth_cm %in% c(0,-10,-20,-30),] #compare the same depths
y<-forMod$Concentration_uM
month<-forMod$month
depth<-as.factor(forMod$depth_cm)
hist(log(y))
mod<-aov(log(y+0.001) ~ month) # transform to meet assumptions of model
summary(mod)
## Df Sum Sq Mean Sq F value Pr(>F)
## month 2 30.2 15.102 1.839 0.167
## Residuals 66 541.9 8.211
par(mfrow=c(2,2))
plot(mod)
####Myo-inositol
forMod<-df[grep('Myo',df$Compound),]
range(forMod$Concentration_uM)
## [1] 0.000000 1.944473
forMod<-forMod[forMod$depth_cm %in% c(0,-10,-20,-30),] #compare the same depths
y<-forMod$Concentration_uM
month<-forMod$month
depth<-as.factor(forMod$depth_cm)
hist(log(y))
mod<-aov(log(y+0.001) ~ month) # transform to meet assumptions of model
summary(mod)
## Df Sum Sq Mean Sq F value Pr(>F)
## month 2 10.87 5.435 1.443 0.244
## Residuals 66 248.62 3.767
par(mfrow=c(2,2))
plot(mod)
####Fructose
forMod<-df[grep('Fructose',df$Compound),]
range(forMod$Concentration_uM)
## [1] 0.00000 10.59883
forMod<-forMod[forMod$depth_cm %in% c(0,-10,-20,-30),] #compare the same depths
y<-forMod$Concentration_uM
month<-forMod$month
depth<-as.factor(forMod$depth_cm)
hist(log(y))
mod<-aov(log(y+0.001) ~ month) # transform to meet assumptions of model
summary(mod)
## Df Sum Sq Mean Sq F value Pr(>F)
## month 2 73.1 36.55 5.001 0.0095 **
## Residuals 66 482.4 7.31
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
par(mfrow=c(2,2))
plot(mod)
TukeyHSD(mod, which='month')
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = log(y + 0.001) ~ month)
##
## $month
## diff lwr upr p adj
## July-April -1.7555457 -4.013462 0.5023710 0.1572193
## October-April -2.5688843 -4.516601 -0.6211675 0.0066010
## October-July -0.8133387 -2.720984 1.0943066 0.5655557
ggplot(df, aes(x=month, y=Concentration_uM,fill=Compound))+
geom_violin(fill='gray') +
geom_jitter(width=0.15, height=0, alpha=0.75, shape=21,size=3)+
xlab('')+
facet_wrap(~Compound, scales='free') + ylab(expression(paste('Metabolite concentration ','(',mu,'M)'))) +
theme(legend.position = 'bottom')+ labs(size=expression(paste('Metabolite concentration ','(',mu,'M)'))) + guides(fill=F)
quant.df<-read.csv('Data/targeted_porewater/diel_pw_sucrose.csv')
quant.df$value_ribitol<-quant.df$value/quant.df$Ribitol_internal_standard
quant.df$FileID<-gsub('.D','',quant.df$Data.File)
Add in calibration data and convert to uM conc<-normalized value / slope
quant.df$slope<-as.numeric(as.vector(eqns[match(quant.df$Compound,eqns$Compound),'slope']))
quant.df$Concentration_uM<-quant.df$value_ribitol/quant.df$slope
range(quant.df$Concentration_uM)
## [1] 0.01617213 750.65259041
summary(quant.df$Concentration_uM)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.0162 0.0557 0.2702 35.3330 12.4627 750.6526
Add in metadata
mdata<-read.csv('Data/targeted_porewater/mdata_salty_samples.csv')
head(mdata)
## X Sample_ID Collection_date Time Month Site
## 1 use 2085 4/10/17 9:00:00 AM April Carrie Bow Caye
## 2 use 2087 4/10/17 9:00:00 AM April Carrie Bow Caye
## 3 use 2086 4/10/17 9:00:00 AM April Carrie Bow Caye
## 4 use 2080 4/10/17 9:00:00 AM April Carrie Bow Caye
## 5 use 2079 4/10/17 9:00:00 AM April Carrie Bow Caye
## 6 use 989 4/6/17 10:00:00 AM April Twin Cayes
## Substrate ProfileID Sediment_depth_cm
## 1 coraline sediment Profile 3 0
## 2 coraline sediment Profile 4 0
## 3 coraline sediment Profile 3 -5
## 4 coraline sediment Profile 1 -10
## 5 coraline sediment Profile 1 -5
## 6 Fisheries beach Tutle seagrass Profile 6 -30
## GCMS_ID TransectLocation uL.of.mix MixID Analysis TransectID
## 1 MS16_20170713_039 <NA> NA <NA> CompSpp <NA>
## 2 MS16_20170713_045 <NA> NA <NA> CompSpp <NA>
## 3 MS16_20170713_051 <NA> NA <NA> CompSpp <NA>
## 4 MS16_20170726_037 <NA> NA <NA> CompSpp <NA>
## 5 MS16_20170726_042 <NA> NA <NA> CompSpp <NA>
## 6 MS16_20170712_008 <NA> NA <NA> CompSpp <NA>
## Keep
## 1 <NA>
## 2 <NA>
## 3 <NA>
## 4 <NA>
## 5 <NA>
## 6 <NA>
quant.df$Date<-droplevels(mdata[match(quant.df$FileID, mdata$GCMS_ID),'Collection_date'])
quant.df$Time<-droplevels(mdata[match(quant.df$FileID, mdata$GCMS_ID),'Time'])
quant.df$Lance<-droplevels(mdata[match(quant.df$FileID, mdata$GCMS_ID),'ProfileID'])
head(quant.df)
## Name Data.File Ribitol_internal_standard
## 1 011 A MS15_20170622_066.D 1894173
## 2 021 A MS15_20170622_049.D 5703415
## 3 35 E MS15_20170623_092.D 5784854
## 4 41 A MS15_20170622_040.D 3895498
## 5 31 A MS15_20170622_054.D 5344103
## 6 51 A MS15_20170704_020.D 2801173
## Compound value Compound2
## 1 Sucrose, octakis(trimethylsily) ether Results 38860511 Sucrose
## 2 Sucrose, octakis(trimethylsily) ether Results 32488967 Sucrose
## 3 Sucrose, octakis(trimethylsily) ether Results 22873150 Sucrose
## 4 Sucrose, octakis(trimethylsily) ether Results 22603462 Sucrose
## 5 Sucrose, octakis(trimethylsily) ether Results 21376039 Sucrose
## 6 Sucrose, octakis(trimethylsily) ether Results 19817277 Sucrose
## value_ribitol FileID slope Concentration_uM Date Time
## 1 20.515819 MS15_20170622_066 0.0412 497.95678 5/23/17 10:00
## 2 5.696406 MS15_20170622_049 0.0412 138.26228 5/23/17 12:00
## 3 3.953972 MS15_20170623_092 0.0412 95.97019 5/23/17 14:00
## 4 5.802458 MS15_20170622_040 0.0412 140.83635 5/23/17 20:00
## 5 3.999930 MS15_20170622_054 0.0412 97.08568 5/23/17 14:00
## 6 7.074635 MS15_20170704_020 0.0412 171.71445 5/23/17 22:00
## Lance
## 1 A
## 2 A
## 3 E
## 4 A
## 5 A
## 6 A
#Convert to DateTime
quant.df$Date_Time<-as.POSIXct(paste(quant.df$Date, quant.df$Time),format='%m/%d/%y %H:%M')
str(quant.df$Date_Time)
## POSIXct[1:70], format: "2017-05-23 10:00:00" "2017-05-23 12:00:00" ...
df.sediment<-quant.df
df.sediment<-df.sediment[!df.sediment$Date_Time=='2017-05-23 21:00:00',] #removes the only time point from 9
df<-df.sediment
str(df.sediment)
## 'data.frame': 69 obs. of 14 variables:
## $ Name : Factor w/ 70 levels "001 A","011 A",..: 2 3 29 36 25 45 8 18 15 53 ...
## $ Data.File : Factor w/ 70 levels "MS15_20170517_19.D",..: 14 7 27 3 9 56 69 37 51 20 ...
## $ Ribitol_internal_standard: int 1894173 5703415 5784854 3895498 5344103 2801173 592177 5143347 5530285 6776863 ...
## $ Compound : Factor w/ 1 level "Sucrose, octakis(trimethylsily) ether Results": 1 1 1 1 1 1 1 1 1 1 ...
## $ value : int 38860511 32488967 22873150 22603462 21376039 19817277 18314191 12681917 11676393 11099680 ...
## $ Compound2 : Factor w/ 1 level "Sucrose": 1 1 1 1 1 1 1 1 1 1 ...
## $ value_ribitol : num 20.52 5.7 3.95 5.8 4 ...
## $ FileID : chr "MS15_20170622_066" "MS15_20170622_049" "MS15_20170623_092" "MS15_20170622_040" ...
## $ slope : num 0.0412 0.0412 0.0412 0.0412 0.0412 0.0412 0.0412 0.0412 0.0412 0.0412 ...
## $ Concentration_uM : num 498 138.3 96 140.8 97.1 ...
## $ Date : Factor w/ 2 levels "5/23/17","5/24/17": 1 1 1 1 1 1 1 1 1 2 ...
## $ Time : Factor w/ 9 levels "00:00:00","02:00:00",..: 4 5 6 7 6 9 4 5 5 1 ...
## $ Lance : Factor w/ 11 levels "A","B","C","D",..: 1 1 5 1 1 1 5 5 2 1 ...
## $ Date_Time : POSIXct, format: "2017-05-23 10:00:00" "2017-05-23 12:00:00" ...
table(df.sediment$Lance)
##
## A B C D E F G H I J K
## 8 8 8 8 5 7 3 8 7 5 2
#without correlation in model
mod2<-lme(log(Concentration_uM) ~ Date_Time, random = ~1|Lance, data=df.sediment)
hist(log(df.sediment$Concentration_uM))
par(mfrow=c(2,2))
qqnorm(resid(mod2))
E2<-resid(mod2, type = "normalized") # extract normalized residuals
F2<-fitted(mod2) # extract the fitted data
plot(F2, E2, xlab = "fitted values", ylab = "residuals") # plot the relationship
# test for homogeneity of variances
boxplot(E2~df.sediment$Lance, ylab = "residuals")
# check for independence. There should be no pattern
plot(E2~df.sediment$Concentration_uM, ylab = 'residuals', xlab = "Concentration uM")
mod2
## Linear mixed-effects model fit by REML
## Data: df.sediment
## Log-restricted-likelihood: -138.5558
## Fixed: log(Concentration_uM) ~ Date_Time
## (Intercept) Date_Time
## 3.877733e+04 -2.592855e-05
##
## Random effects:
## Formula: ~1 | Lance
## (Intercept) Residual
## StdDev: 2.819722 1.190744
##
## Number of Observations: 69
## Number of Groups: 11
summary(mod2)
## Linear mixed-effects model fit by REML
## Data: df.sediment
## AIC BIC logLik
## 285.1116 293.9304 -138.5558
##
## Random effects:
## Formula: ~1 | Lance
## (Intercept) Residual
## StdDev: 2.819722 1.190744
##
## Fixed effects: log(Concentration_uM) ~ Date_Time
## Value Std.Error DF t-value p-value
## (Intercept) 38777.33 9410.12 57 4.120812 1e-04
## Date_Time 0.00 0.00 57 -4.120842 1e-04
## Correlation:
## (Intr)
## Date_Time -1
##
## Standardized Within-Group Residuals:
## Min Q1 Med Q3 Max
## -1.9455505 -0.6142359 -0.1583106 0.6235012 1.9877665
##
## Number of Observations: 69
## Number of Groups: 11
anova(mod2)
## numDF denDF F-value p-value
## (Intercept) 1 57 0.108723 0.7428
## Date_Time 1 57 16.981338 0.0001
df.sediment$Date_Time<-as.POSIXct(df.sediment$Date_Time,format='%Y-%m-%d %H:%M:%S')
#Calculate means
df.sediment<-df.sediment[complete.cases(df.sediment),]
means<-ddply(df.sediment, .(Date_Time), summarise, mean=mean(Concentration_uM))
means$part<-'sediment'
df.sediment$part<-'sediment'
#df.sediment[df.sediment$Concentration_uM > 200,'Concentration_uM']<-NA
p.sediment<-ggplot(df.sediment, aes(x=Date_Time, y=Concentration_uM, group=Date_Time)) +
geom_violin(fill='gray', alpha=0.5) + geom_jitter(shape=21, color='black', fill='dodgerblue4', alpha=0.75,size=3, height=0, width=1000)+
geom_path(data=means, aes(y=mean, group=part), color='darksalmon',size=1, linetype='solid') +
geom_point(data=means, aes(y=mean, group=Date_Time), color='black',size=3) +
scale_x_datetime(date_breaks='2 hour', date_labels='%H:%M') + facet_grid(part~.)+
ylab('Sucrose concentration (uM)') + xlab('Collection time')
p.sediment
quant.df<-read.csv('Data/targeted_porewater/diel_plants_sucrose.csv')
quant.df$value_ribitol<-quant.df$value/quant.df$Ribitol_internal_standard
quant.df$FileID<-gsub('.D','',quant.df$Data.File)
# Add in metadata
mdata<-read.csv('Data/targeted_porewater/metabar_galanzana_24hr_sg.csv')
head(mdata)
## PlantID TimePoint Date Plant_Replicate Plant_part VialID Weight_g
## 1 221 00:00 2017-05-24 F Rhizomes 862 0.0536
## 2 221 00:00 2017-05-24 F Roots 857 0.0500
## 3 222 00:00 2017-05-24 E Leaves 899 0.0446
## 4 222 00:00 2017-05-24 E Rhizomes 896 0.0513
## 5 222 00:00 2017-05-24 E Roots 892 0.0536
## 6 223 00:00 2017-05-24 D Leaves 773 0.0434
## Notes GC_MS_FileName
## 1 <NA> MS1_20170830_051
## 2 <NA> MS1_20170831_081
## 3 <NA> MS1_20170830_041
## 4 <NA> MS1_20170831_074
## 5 <NA> MS1_20170830_055
## 6 <NA> MS1_20170828_014
# Add in metadata
quant.df$part<-mdata[match(quant.df$FileID, mdata$GC_MS_FileName),'Plant_part']
quant.df$Weight_g<-mdata[match(quant.df$FileID, mdata$GC_MS_FileName),'Weight_g']
quant.df$Time<-mdata[match(quant.df$FileID, mdata$GC_MS_FileName),'TimePoint']
quant.df$Date<-mdata[match(quant.df$FileID, mdata$GC_MS_FileName),'Date']
quant.df$Replicate<-mdata[match(quant.df$FileID, mdata$GC_MS_FileName),'Plant_Replicate']
#Convert to DateTime
quant.df$Date_Time<-as.POSIXct(paste(quant.df$Date, quant.df$Time),format='%Y-%m-%d %H:%M')
str(quant.df$Date_Time)
## POSIXct[1:102], format: "2017-05-24 05:00:00" NA NA NA NA NA "2017-05-23 12:00:00" ...
unique(quant.df$Date_Time)
## [1] "2017-05-24 05:00:00 CEST" NA
## [3] "2017-05-23 12:00:00 CEST" "2017-05-23 10:00:00 CEST"
## [5] "2017-05-23 20:00:00 CEST" "2017-05-24 00:00:00 CEST"
## [7] "2017-05-23 14:00:00 CEST"
head(quant.df)
## Name Data.File Ribitol_internal_standard
## 1 521 MS1_20170901_033.D 17376
## 2 BLK 5 MS1_20170831_077.D 27226
## 3 BLK 6 MS1_20170831_089.D 8157
## 4 BLK 8.21 MS1_20170901_046.D 572
## 5 BLK Aug. 21 MS1_20170901_011.D 490
## 6 Extraction blk MS1_20170828_023.D 1314
## Compound value Compound2
## 1 Sucrose, octakis(trimethylsily) ether Results 0 Sucrose
## 2 Sucrose, octakis(trimethylsily) ether Results 1463 Sucrose
## 3 Sucrose, octakis(trimethylsily) ether Results 1469 Sucrose
## 4 Sucrose, octakis(trimethylsily) ether Results 7323 Sucrose
## 5 Sucrose, octakis(trimethylsily) ether Results 7798 Sucrose
## 6 Sucrose, octakis(trimethylsily) ether Results 9416 Sucrose
## value_ribitol FileID part Weight_g Time
## 1 0.0000000 MS1_20170901_033 Roots 0.0491 05:00
## 2 0.0537354 MS1_20170831_077 Extraction Blank NA <NA>
## 3 0.1800907 MS1_20170831_089 Extraction Blank NA <NA>
## 4 12.8024476 MS1_20170901_046 Extraction Blank NA <NA>
## 5 15.9142857 MS1_20170901_011 Extraction Blank NA <NA>
## 6 7.1659056 MS1_20170828_023 Extraction Blank NA <NA>
## Date Replicate Date_Time
## 1 2017-05-24 C 2017-05-24 05:00:00
## 2 <NA> <NA> <NA>
## 3 <NA> <NA> <NA>
## 4 <NA> <NA> <NA>
## 5 <NA> <NA> <NA>
## 6 <NA> <NA> <NA>
#Normalize counts to g of tissue
quant.df$value_normalized_to_g<-quant.df$value/quant.df$Weight_g
quant.df$value_ribitol_normalized_to_g<-quant.df$value_ribitol/quant.df$Weight_g
df.plants<-quant.df
df.roots<-df.plants[df.plants$part=='Roots',]
model: sucrose normalized to tissue weight ~ time
mod<-lm(value_normalized_to_g ~ factor(Date_Time), data=df.roots)
par(mfrow=c(2,2))
plot(mod)
summary(mod)
##
## Call:
## lm(formula = value_normalized_to_g ~ factor(Date_Time), data = df.roots)
##
## Residuals:
## Min 1Q Median 3Q Max
## -315763451 -124263228 13208247 119904850 329082672
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 241084112 75678129 3.186 0.00353
## factor(Date_Time)2017-05-23 12:00:00 75365438 102468672 0.735 0.46815
## factor(Date_Time)2017-05-23 14:00:00 -15595045 102468672 -0.152 0.88013
## factor(Date_Time)2017-05-23 20:00:00 -61279881 102468672 -0.598 0.55462
## factor(Date_Time)2017-05-24 00:00:00 5779196 107025037 0.054 0.95732
## factor(Date_Time)2017-05-24 05:00:00 -66269518 102468672 -0.647 0.52307
##
## (Intercept) **
## factor(Date_Time)2017-05-23 12:00:00
## factor(Date_Time)2017-05-23 14:00:00
## factor(Date_Time)2017-05-23 20:00:00
## factor(Date_Time)2017-05-24 00:00:00
## factor(Date_Time)2017-05-24 05:00:00
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 169200000 on 28 degrees of freedom
## Multiple R-squared: 0.09112, Adjusted R-squared: -0.07117
## F-statistic: 0.5615 on 5 and 28 DF, p-value: 0.7285
anov<-aov(mod)
summary(anov)
## Df Sum Sq Mean Sq F value Pr(>F)
## factor(Date_Time) 5 8.039e+16 1.608e+16 0.561 0.729
## Residuals 28 8.018e+17 2.864e+16
df.rhizomes<-df.plants[df.plants$part=='Rhizomes',]
model: sucrose normalized to tissue weight ~ time
mod<-lm(value_normalized_to_g ~ factor(Date_Time), data=df.rhizomes)
par(mfrow=c(2,2))
plot(mod)
summary(mod)
##
## Call:
## lm(formula = value_normalized_to_g ~ factor(Date_Time), data = df.rhizomes)
##
## Residuals:
## Min 1Q Median 3Q Max
## -328806479 -46736886 37572205 58460404 218014482
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 406925450 59159511 6.878 1.48e-07
## factor(Date_Time)2017-05-23 12:00:00 -79916033 83664183 -0.955 0.347
## factor(Date_Time)2017-05-23 14:00:00 -18327552 87747735 -0.209 0.836
## factor(Date_Time)2017-05-23 20:00:00 2962347 83664183 0.035 0.972
## factor(Date_Time)2017-05-24 00:00:00 16667964 83664183 0.199 0.843
## factor(Date_Time)2017-05-24 05:00:00 -14897168 83664183 -0.178 0.860
##
## (Intercept) ***
## factor(Date_Time)2017-05-23 12:00:00
## factor(Date_Time)2017-05-23 14:00:00
## factor(Date_Time)2017-05-23 20:00:00
## factor(Date_Time)2017-05-24 00:00:00
## factor(Date_Time)2017-05-24 05:00:00
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 144900000 on 29 degrees of freedom
## Multiple R-squared: 0.05381, Adjusted R-squared: -0.1093
## F-statistic: 0.3299 on 5 and 29 DF, p-value: 0.8908
anov<-aov(mod)
summary(anov)
## Df Sum Sq Mean Sq F value Pr(>F)
## factor(Date_Time) 5 3.463e+16 6.927e+15 0.33 0.891
## Residuals 29 6.090e+17 2.100e+16
df.leaves<-df.plants[df.plants$part=='Leaves',]
model: sucrose normalized to tissue weight ~ time
mod<-lm(value_normalized_to_g ~ factor(Date_Time), data=df.leaves)
par(mfrow=c(2,2))
plot(mod)
summary(mod)
##
## Call:
## lm(formula = value_normalized_to_g ~ factor(Date_Time), data = df.leaves)
##
## Residuals:
## Min 1Q Median 3Q Max
## -89068104 -24422691 10808401 36836465 58948503
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 53637649 18838164 2.847 0.009120
## factor(Date_Time)2017-05-23 14:00:00 45385002 27941513 1.624 0.117942
## factor(Date_Time)2017-05-23 20:00:00 101989641 26641188 3.828 0.000861
## factor(Date_Time)2017-05-24 00:00:00 40326085 27941513 1.443 0.162438
## factor(Date_Time)2017-05-24 05:00:00 18831328 26641188 0.707 0.486760
##
## (Intercept) **
## factor(Date_Time)2017-05-23 14:00:00
## factor(Date_Time)2017-05-23 20:00:00 ***
## factor(Date_Time)2017-05-24 00:00:00
## factor(Date_Time)2017-05-24 05:00:00
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 46140000 on 23 degrees of freedom
## Multiple R-squared: 0.4199, Adjusted R-squared: 0.319
## F-statistic: 4.162 on 4 and 23 DF, p-value: 0.01111
anov<-aov(mod)
summary(anov)
## Df Sum Sq Mean Sq F value Pr(>F)
## factor(Date_Time) 4 3.545e+16 8.863e+15 4.162 0.0111 *
## Residuals 23 4.897e+16 2.129e+15
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(anov)
## Tukey multiple comparisons of means
## 95% family-wise confidence level
##
## Fit: aov(formula = mod)
##
## $`factor(Date_Time)`
## diff lwr upr
## 2017-05-23 14:00:00-2017-05-23 10:00:00 45385002 -37210798 127980802
## 2017-05-23 20:00:00-2017-05-23 10:00:00 101989641 23237636 180741647
## 2017-05-24 00:00:00-2017-05-23 10:00:00 40326085 -42269715 122921885
## 2017-05-24 05:00:00-2017-05-23 10:00:00 18831328 -59920677 97583334
## 2017-05-23 20:00:00-2017-05-23 14:00:00 56604639 -25991161 139200439
## 2017-05-24 00:00:00-2017-05-23 14:00:00 -5058917 -91327417 81209583
## 2017-05-24 05:00:00-2017-05-23 14:00:00 -26553674 -109149474 56042126
## 2017-05-24 00:00:00-2017-05-23 20:00:00 -61663556 -144259356 20932244
## 2017-05-24 05:00:00-2017-05-23 20:00:00 -83158313 -161910318 -4406307
## 2017-05-24 05:00:00-2017-05-24 00:00:00 -21494757 -104090557 61101043
## p adj
## 2017-05-23 14:00:00-2017-05-23 10:00:00 0.4977015
## 2017-05-23 20:00:00-2017-05-23 10:00:00 0.0069508
## 2017-05-24 00:00:00-2017-05-23 10:00:00 0.6074150
## 2017-05-24 05:00:00-2017-05-23 10:00:00 0.9528302
## 2017-05-23 20:00:00-2017-05-23 14:00:00 0.2856590
## 2017-05-24 00:00:00-2017-05-23 14:00:00 0.9997813
## 2017-05-24 05:00:00-2017-05-23 14:00:00 0.8740384
## 2017-05-24 00:00:00-2017-05-23 20:00:00 0.2125978
## 2017-05-24 05:00:00-2017-05-23 20:00:00 0.0350026
## 2017-05-24 05:00:00-2017-05-24 00:00:00 0.9368645
df.plants<-df.plants[df.plants$part %in% c('Leaves','Rhizomes','Roots'),]
#get means
means<-ddply(df.plants, .(Date_Time,part), summarise, means=mean(value))
means$Date_Time<-as.POSIXct(means$Date_Time, '%Y-%m-%d %H:%M:%S')
df.plants$Date_Time<-as.POSIXct(paste(df.plants$Date, df.plants$Time),'%Y-%m-%d %H:%M:%S')
## Warning in strptime(xx, f, tz = tz): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(x): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in strptime(xx, f, tz = tz): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(x): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in strptime(xx, f, tz = tz): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(x): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in strptime(x, f, tz = tz): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(as.POSIXlt(x, tz, ...), tz, ...): unknown
## timezone '%Y-%m-%d %H:%M:%S'
df.plants<-df.plants[complete.cases(df.plants),]
p.plants<-ggplot(df.plants, aes(x=Date_Time, y=value, group=Date_Time)) +
geom_violin(fill='gray', alpha=0.5) + geom_point(shape=21, color='black', fill='dodgerblue4', alpha=0.75,size=3)+
geom_path(data=means, aes(y=means, group=part, color=part),size=1, linetype='solid') +
scale_color_manual(values=c('darkseagreen','darkred','lightcoral')) +
geom_point(data=means, aes(y=means, group=Date_Time), color='black',size=3) +
facet_grid(part~.) +
ylab('Sucrose ion intensity (m/z=361) / g tissue') + scale_x_datetime(date_breaks='2 hour', date_labels='%H:%M')+
xlab('') + theme(axis.text.x = element_blank()) + guides(color=F)
p.plants
## Warning in as.POSIXlt.POSIXct(min(x, na.rm = TRUE)): unknown timezone '%Y-
## %m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(from): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(from): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXlt.POSIXct(x, tz): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in strptime(xx, f, tz = tz): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(x): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in strptime(x, f, tz = tz): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(as.POSIXlt(x, tz, ...), tz, ...): unknown
## timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXlt.POSIXct(min(x, na.rm = TRUE)): unknown timezone '%Y-
## %m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(from): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(from): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXlt.POSIXct(x, tz): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in strptime(xx, f, tz = tz): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(x): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in strptime(x, f, tz = tz): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(as.POSIXlt(x, tz, ...), tz, ...): unknown
## timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXlt.POSIXct(x, tz): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXlt.POSIXct(min(x, na.rm = TRUE)): unknown timezone '%Y-
## %m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(from): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(from): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXlt.POSIXct(x, tz): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in strptime(xx, f, tz = tz): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(x): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in strptime(x, f, tz = tz): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(as.POSIXlt(x, tz, ...), tz, ...): unknown
## timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXlt.POSIXct(min(x, na.rm = TRUE)): unknown timezone '%Y-
## %m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(from): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(from): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXlt.POSIXct(x, tz): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in strptime(xx, f, tz = tz): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(x): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in strptime(x, f, tz = tz): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(as.POSIXlt(x, tz, ...), tz, ...): unknown
## timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXlt.POSIXct(x, tz): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXlt.POSIXct(min(x, na.rm = TRUE)): unknown timezone '%Y-
## %m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(from): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(from): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXlt.POSIXct(x, tz): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in strptime(xx, f, tz = tz): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(x): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in strptime(x, f, tz = tz): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(as.POSIXlt(x, tz, ...), tz, ...): unknown
## timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXlt.POSIXct(min(x, na.rm = TRUE)): unknown timezone '%Y-
## %m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(from): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(from): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXlt.POSIXct(x, tz): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in strptime(xx, f, tz = tz): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(x): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in strptime(x, f, tz = tz): unknown timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXct.POSIXlt(as.POSIXlt(x, tz, ...), tz, ...): unknown
## timezone '%Y-%m-%d %H:%M:%S'
## Warning in as.POSIXlt.POSIXct(x, tz): unknown timezone '%Y-%m-%d %H:%M:%S'
quant.df<-read.csv('Data/targeted_porewater/pw_sg_species_sugars.csv')
head(quant.df)
## Name Data.File Ribitol_internal_standard
## 1 17 20190122_050.D 2564311
## 2 2100 MS16_20170713_054.D 592612
## 3 2102 MS16_20170713_059.D 1047489
## 4 21 20190123_009.D 3488270
## 5 4 20190124_053.D 831044
## 6 36 20190122_039.D 2695652
## Compound
## 1 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 2 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 3 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 4 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 5 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 6 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## value
## 1 0
## 2 0
## 3 0
## 4 0
## 5 0
## 6 0
quant.df$FileID<-gsub('.D','',quant.df$Data.File)
quant.df$value_ribitol<-quant.df$value/quant.df$Ribitol_internal_standard
Add in metadata
mdata<-read.csv('Data/targeted_porewater/mdata_salty_samples.csv')
head(mdata)
## X Sample_ID Collection_date Time Month Site
## 1 use 2085 4/10/17 9:00:00 AM April Carrie Bow Caye
## 2 use 2087 4/10/17 9:00:00 AM April Carrie Bow Caye
## 3 use 2086 4/10/17 9:00:00 AM April Carrie Bow Caye
## 4 use 2080 4/10/17 9:00:00 AM April Carrie Bow Caye
## 5 use 2079 4/10/17 9:00:00 AM April Carrie Bow Caye
## 6 use 989 4/6/17 10:00:00 AM April Twin Cayes
## Substrate ProfileID Sediment_depth_cm
## 1 coraline sediment Profile 3 0
## 2 coraline sediment Profile 4 0
## 3 coraline sediment Profile 3 -5
## 4 coraline sediment Profile 1 -10
## 5 coraline sediment Profile 1 -5
## 6 Fisheries beach Tutle seagrass Profile 6 -30
## GCMS_ID TransectLocation uL.of.mix MixID Analysis TransectID
## 1 MS16_20170713_039 <NA> NA <NA> CompSpp <NA>
## 2 MS16_20170713_045 <NA> NA <NA> CompSpp <NA>
## 3 MS16_20170713_051 <NA> NA <NA> CompSpp <NA>
## 4 MS16_20170726_037 <NA> NA <NA> CompSpp <NA>
## 5 MS16_20170726_042 <NA> NA <NA> CompSpp <NA>
## 6 MS16_20170712_008 <NA> NA <NA> CompSpp <NA>
## Keep
## 1 <NA>
## 2 <NA>
## 3 <NA>
## 4 <NA>
## 5 <NA>
## 6 <NA>
quant.df$species<-droplevels(mdata[match(quant.df$FileID, mdata$GCMS_ID),'Substrate'])
quant.df$depth_cm<-mdata[match(quant.df$FileID, mdata$GCMS_ID),'Sediment_depth_cm']
head(quant.df)
## Name Data.File Ribitol_internal_standard
## 1 17 20190122_050.D 2564311
## 2 2100 MS16_20170713_054.D 592612
## 3 2102 MS16_20170713_059.D 1047489
## 4 21 20190123_009.D 3488270
## 5 4 20190124_053.D 831044
## 6 36 20190122_039.D 2695652
## Compound
## 1 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 2 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 3 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 4 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 5 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## 6 D-Fructose, pentakis(trimethylsilyl) ether, methloxime (ant) Results
## value FileID value_ribitol species
## 1 0 20190122_050 0 Zosteria marina
## 2 0 MS16_20170713_054 0 Fisheries beach Tutle seagrass
## 3 0 MS16_20170713_059 0 Fisheries beach Tutle seagrass
## 4 0 20190123_009 0 Zosteria marina
## 5 0 20190124_053 0 Zosteria marina
## 6 0 20190122_039 0 Zosteria marina
## depth_cm
## 1 -10
## 2 -35
## 3 -40
## 4 -30
## 5 -15
## 6 0
unique(quant.df$species)
## [1] Zosteria marina Fisheries beach Tutle seagrass
## [3] Manatee seagrass patch Mix seagrass patch
## 4 Levels: Fisheries beach Tutle seagrass ... Zosteria marina
Seperate kiel and other datasets
quant.df.kiel<-quant.df[quant.df$species=='Zosteria marina',]
quant.df<-quant.df[!quant.df$species=='Zosteria marina',]
Add in calibration data and convert to uM conc<-normalized value / slope
quant.df$slope<-as.numeric(as.vector(eqns[match(quant.df$Compound,eqns$Compound),'slope']))
quant.df$Concentration_uM<-quant.df$value_ribitol/quant.df$slope
range(quant.df$Concentration_uM)
## [1] 0.000 1018.632
summary(quant.df$Concentration_uM)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.0000 0.1154 0.4396 14.6383 1.7417 1018.6325
quant.df.kiel$slope<-as.numeric(as.vector(eqns[match(quant.df.kiel$Compound,eqns2$Compound),'slope']))
quant.df.kiel$Concentration_uM<-quant.df.kiel$value_ribitol/quant.df.kiel$slope
range(quant.df.kiel$Concentration_uM)
## [1] 0.00000 39.65654
summary(quant.df.kiel$Concentration_uM)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.00000 0.00000 0.04375 0.34193 0.19007 39.65654